Add procedure to convert Garmin 'display' value between waypoint protocols.
authoroliskoli <oliskoli@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Sun, 30 Apr 2006 16:59:38 +0000 (16:59 +0000)
committeroliskoli <oliskoli@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Sun, 30 Apr 2006 16:59:38 +0000 (16:59 +0000)
gpsbabel/garmin_tables.c
gpsbabel/garmin_tables.h

index e6fc88c70fa23a7d52c95fa7ad8a152fb8600134..06030623bed00ab7684c40f94d02a181ec71fbc6 100644 (file)
@@ -494,6 +494,52 @@ char *gt_display_mode_names[] = {
        "Symbol & Description"
 };
 
+unsigned char
+gt_switch_display_mode_value(const unsigned char display_mode, const int protoid, const char device)
+{
+       if (device) {
+               switch(protoid) {
+               
+               case 103: 
+               case 107: 
+               case 108: 
+               case 109: 
+               case 110: return display_mode & 3; 
+               case 104:
+                       switch(display_mode) {
+                               case 0:
+                               case 1: return gt_display_mode_symbol;
+                               case 3: return gt_display_mode_symbol_and_name;
+                               case 5: return gt_display_mode_symbol_and_comment;
+                       }
+               case 155:
+                       switch(display_mode) {
+                               case 1: return gt_display_mode_symbol;
+                               case 3: return gt_display_mode_symbol_and_name;
+                               case 5: return gt_display_mode_symbol_and_comment;
+                       }
+               }
+               return gt_display_mode_symbol_and_name;
+       } else {
+               switch(protoid) {
+               
+               case 103: 
+               case 107: 
+               case 108: 
+               case 109: 
+               case 110: return display_mode & 3;
+               case 104:
+               case 155:
+                       switch(display_mode) {
+                               case gt_display_mode_symbol: return 1;
+                               case gt_display_mode_symbol_and_name: return 3;
+                               case gt_display_mode_symbol_and_comment: return 5;
+                       }
+               }
+               return 0;
+       }
+}
+
 char *
 gt_find_desc_from_icon_number(const int icon, garmin_formats_e garmin_format, int *dynamic)
 {
index 350a47f19513cbe877c87448a72588c6982eb4d6..79667843c705d6da68ce5fb103690ea3a92a41b1 100644 (file)
@@ -90,4 +90,6 @@ typedef enum {
 
 unsigned char gt_convert_category(const char *name, int *category);
 
+unsigned char gt_switch_display_mode_value(const unsigned char display_mode, const int protoid, const char device);
+
 #endif